home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / programming / other / dopus412-gpl / program / asyncio.h < prev    next >
C/C++ Source or Header  |  2000-02-28  |  4KB  |  113 lines

  1. /*
  2.  
  3. Directory Opus 4
  4. Original GPL release version 4.12
  5. Copyright 1993-2000 Jonathan Potter
  6.  
  7. This program is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU General Public License
  9. as published by the Free Software Foundation; either version 2
  10. of the License, or (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. All users of Directory Opus 4 (including versions distributed
  22. under the GPL) are entitled to upgrade to the latest version of
  23. Directory Opus version 5 at a reduced price. Please see
  24. http://www.gpsoft.com.au for more information.
  25.  
  26. The release of Directory Opus 4 under the GPL in NO WAY affects
  27. the existing commercial status of Directory Opus 5.
  28.  
  29. */
  30.  
  31. #ifndef ASYNCIO_H
  32. #define ASYNCIO_H
  33.  
  34.  
  35. /*****************************************************************************/
  36.  
  37.  
  38. #ifndef EXEC_TYPES_H
  39. #include <exec/types.h>
  40. #endif
  41.  
  42. #ifndef EXEC_PORTS_H
  43. #include <exec/ports.h>
  44. #endif
  45.  
  46. #ifndef DOS_DOS_H
  47. #include <dos/dos.h>
  48. #endif
  49.  
  50.  
  51. /*****************************************************************************/
  52.  
  53.  
  54. /* This structure is public only by necessity, don't muck with it yourself, or
  55.  * you're looking for trouble
  56.  */
  57. struct AsyncFile
  58. {
  59.     BPTR                  af_File;
  60.     ULONG                 af_BlockSize;
  61.     struct MsgPort       *af_Handler;
  62.     APTR                  af_Offset;
  63.     LONG                  af_BytesLeft;
  64.     ULONG              af_BufferSize;
  65.     APTR              af_Buffers[2];
  66.     struct StandardPacket af_Packet;
  67.     struct MsgPort        af_PacketPort;
  68.     ULONG                 af_CurrentBuf;
  69.     ULONG                 af_SeekOffset;
  70.     UBYTE              af_PacketPending;
  71.     UBYTE              af_ReadMode;
  72. };
  73.  
  74.  
  75. /*****************************************************************************/
  76.  
  77.  
  78. #define MODE_READ   0  /* read an existing file                             */
  79. #define MODE_WRITE  1  /* create a new file, delete existing file if needed */
  80. #define MODE_APPEND 2  /* append to end of existing file, or create new     */
  81.  
  82. #define MODE_START   -1   /* relative to start of file         */
  83. #define MODE_CURRENT  0   /* relative to current file position */
  84. #define MODE_END      1   /* relative to end of file         */
  85.  
  86.  
  87. /*****************************************************************************/
  88.  
  89.  
  90. #ifdef __SASC_60
  91. __stdargs struct AsyncFile *OpenAsync(const STRPTR fileName, UBYTE accessMode, LONG bufferSize);
  92. __stdargs LONG CloseAsync(struct AsyncFile *file);
  93. __stdargs LONG ReadAsync(struct AsyncFile *file, APTR buffer, LONG numBytes);
  94. __stdargs LONG ReadCharAsync(struct AsyncFile *file);
  95. __stdargs LONG WriteAsync(struct AsyncFile *file, APTR buffer, LONG numBytes);
  96. __stdargs LONG WriteCharAsync(struct AsyncFile *file, UBYTE ch);
  97. __stdargs LONG SeekAsync(struct AsyncFile *file, LONG position, BYTE mode);
  98. #else
  99. struct AsyncFile *__stdargs OpenAsync(const STRPTR fileName, UBYTE accessMode, LONG bufferSize);
  100. LONG __stdargs CloseAsync(struct AsyncFile *file);
  101. LONG __stdargs ReadAsync(struct AsyncFile *file, APTR buffer, LONG numBytes);
  102. LONG __stdargs ReadCharAsync(struct AsyncFile *file);
  103. LONG __stdargs WriteAsync(struct AsyncFile *file, APTR buffer, LONG numBytes);
  104. LONG __stdargs WriteCharAsync(struct AsyncFile *file, UBYTE ch);
  105. LONG __stdargs SeekAsync(struct AsyncFile *file, LONG position, BYTE mode);
  106. #endif
  107.  
  108. /*****************************************************************************/
  109.  
  110.  
  111. #endif /* ASYNCIO_H */
  112.  
  113.